package za.ac.lance.OpenClosePrinciple.violates;

/**
 * File Name: GraphicEditorViolates.java
 * Version:
 * Description: Open close principle (OCP) is violated Because the moment another
 *              shape is added most of the code must chance.
 * Package: za.ac.lance.opencloseprinciple.violates
 * Author: Lance
 * Date: Feb 24, 2012
 */
public class GraphicEditorViolates
{

    public static void drawShape(ShapeViolates shape)
    {
        if (shape.getShapeType() == 1)
        {
            drawRectangle(shape);
        }
        else if (shape.getShapeType() == 2)
        {
            drawCircle(shape);
        }
    }

    public static void drawRectangle(ShapeViolates r)
    {
        System.out.println("Drawing Rectangle " + r.toString());
    }

    public static void drawCircle(ShapeViolates c)
    {
        System.out.println("Drawing Circle " + c.toString());
    }
}
